import request from "@/utils/request";

/**
 * 分页查询商品
 * @param param
 * @returns {AxiosPromise}
 */
export function page(param) {
    return request({
        url: '/commodity/page',
        method: 'get',
        params: param
    })
}

/**
 * 上架商品
 * @param uuid
 * @returns {AxiosPromise}
 */
export function put(uuid) {
    return request({
        url: '/commodity/put/' + uuid,
        method: 'put',
    })
}

/**
 * 下架商品
 * @param uuid
 * @returns {AxiosPromise}
 */
export function drop(uuid) {
    return request({
        url: '/commodity/drop/' + uuid,
        method: 'put',
    })
}

/**
 * 删除商品
 * @param uuid
 * @returns {AxiosPromise}
 */
export function deleted(uuid) {
    return request({
        url: '/commodity/delete/' + uuid,
        method: 'delete'
    })
}

/**
 * 商品详情
 * @param uuid
 * @returns {AxiosPromise}
 */
export function detail(uuid) {
    return request({
        url: '/commodity/detail/' + uuid,
        method: 'get'
    })
}

/**
 * 审核未通过
 * @returns {AxiosPromise}
 * @param param
 */
export function noPass(param) {
    return request({
        url: '/commodity/no-pass/' + param.uuid,
        method: 'put',
        data: param
    })
}

/**
 * 审核通过
 * @returns {AxiosPromise}
 * @param param
 */
export function pass(param) {
    return request({
        url: '/commodity/pass/' + param.uuid,
        method: 'put',
        data: param
    })
}

/**
 * 商品导出
 * @returns {AxiosPromise}
 * @param param
 */
export function exportCommodity(param) {
    return request({
        url: '/commodity/export',
        method: 'post',
        params: param,
        responseType: 'blob'
    })
}

/**
 * 批量下架
 * @returns {AxiosPromise}
 * @param param
 */
export function batchDrop(param) {
    return request({
        url: '/commodity/batch-drop',
        method: 'put',
        data: param
    })
}

/**
 * 批量上架
 * @returns {AxiosPromise}
 * @param param
 */
export function batchPut(param) {
    return request({
        url: '/commodity/batch-put',
        method: 'put',
        data: param
    })
}

/**
 * 批量删除
 * @returns {AxiosPromise}
 * @param param
 */
export function batchDelete(param) {
    return request({
        url: '/commodity/batch-delete',
        method: 'delete',
        data: param
    })
}